Skip to content

Conversation

kkysen
Copy link
Contributor

@kkysen kkysen commented Jul 13, 2022

This switches all rust-toolchains to rust-toolchain.tomls so we can specify components (and targets, etc. where needed).

The benefit of this is that cargo will automatically download the needed components and targets instead of erroring, which is very useful when upgrading our nightly. CI breaks when this happens, and we can't simultaneously support multiple nightly versions (across branches and PRs) as we migrate. It is still useful for the Docker containers to pre-install them, as that saves on re-downloading them every time, but it should prevent hard errors. Furthermore, it is useful when developing locally as well.

This should (hopefully) make #513 pass CI.

Previously, we would emit a rust-toolchain file in the transpiled crate if nightly features we needed. That was simple with a rust-toolchain file, but with rust-toolchain.toml, it's more complex, as we don't want to override fields in an existing rust-toolchain.toml that we don't have to. As this is more complex and isn't currently needed for our existing tests and CI, I'll fix it in a future PR that merges/updates (i.e. override the channel, append to components and targets, etc.) the rust-toolchain.toml instead of wholly replacing it.

/// If we translate variadic functions, the output will only compile
/// on a nightly toolchain until the `c_variadics` feature is stable.
fn emit_rust_toolchain(tcfg: &TranspilerConfig, build_dir: &Path) {
let output_path = build_dir.join("rust-toolchain.toml");
let output = include_str!("../../rust-toolchain.toml").to_string();
maybe_write_to_file(&output_path, output, tcfg.overwrite_existing);
}

@kkysen kkysen requested a review from fw-immunant July 13, 2022 16:38
@kkysen
Copy link
Contributor Author

kkysen commented Jul 13, 2022

This is failing CI due to the added toml dependency in requirements.txt. The tests pass locally after doing pip install -r requirements.txt. Once the Docker containers are updated, this should work again.

Copy link
Contributor

@fw-immunant fw-immunant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issues commented inline.

@kkysen
Copy link
Contributor Author

kkysen commented Jul 13, 2022

I thought I had fixed the parsing issues somewhere, but I guess I left that in a stash somewhere along with the toml merge changes.

@kkysen
Copy link
Contributor Author

kkysen commented Jul 13, 2022

@thedataking, this does need a Docker update for the toml Python dependency actually. Then this and #513 will work.

kkysen added 4 commits August 8, 2022 19:09
I still left them in `provision_rust.sh` as well, even though they're not strictly needed,
because it will help to have them cached in the Docker image.
Ideally, I think we'd put c2rust itself (or at least parts of it) into the Docker image as well for caching purposes.
@kkysen kkysen force-pushed the kkysen/rust-toolchain-toml branch from f8793f0 to 9fa4fe6 Compare August 9, 2022 02:10
@kkysen
Copy link
Contributor Author

kkysen commented Aug 9, 2022

@thedataking, CI is still failing on import toml meaning pip install -r requirements.txt still run and get into the pushed Docker containers.

kkysen added 7 commits August 9, 2022 13:33
…st-toolchain.toml`. I believe they should be in sync because this one is produced by copying the root one.
…`query_toml.py`, which is also a CLI and is used in `docker_build.sh` and `provision_mac.sh` to query the channel now.
@kkysen kkysen force-pushed the kkysen/rust-toolchain-toml branch from 21ef06f to 528fba5 Compare August 9, 2022 20:44
@kkysen kkysen merged commit d3bd1ce into master Aug 9, 2022
@kkysen kkysen deleted the kkysen/rust-toolchain-toml branch August 9, 2022 22:13
kkysen added a commit that referenced this pull request Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants